package com.cloudkinto.appletController.firstvesselorder;


import com.cloudkinto.appletservice.firstvesselorder.AppletFirstVesselOrderService;
import com.cloudkinto.base.BaseController;
import com.cloudkinto.common.DicBusinessItemConstant;
import com.cloudkinto.common.annotations.UserSessionRequired;
import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;
import com.cloudkinto.service.fbaproduct.FbaProductService;
import com.cloudkinto.service.firstvesselorder.FirstVesselOrderService;
import com.cloudkinto.service.firstvesselorder.vo.FirstVesselOrderAddReq;
import com.cloudkinto.service.firstvesselorder.vo.FirstVesselOrderUpdateReq;
import com.cloudkinto.service.firstvesselorder.vo.FirstVesselUploadCartonabelReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 * @author zhangyy
 * @since 2020-09-16
 */
@RestController
@Api(tags = "小程序海运订单程模块")
@RequestMapping("/api/applet/seaTransportation")
public class AppletFirstVesselOrderController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(AppletFirstVesselOrderController.class);

    @Autowired
    private AppletFirstVesselOrderService service;



    @GetMapping("/{id}")
    @ApiOperation(value = "根据id查看详情", notes = "根据id查看详情")
    public SingleResult detail(@PathVariable("id") Long id) {
        return SingleResult.success("查询成功",service.detail(id));
    }

    @UserSessionRequired
    @GetMapping("/listPage")
    @ApiOperation(value = "查询（分页）", notes = "查询（分页）")
    public PageResult listPage(HttpServletRequest request){
        Long companyId = getCompanyId();

        Map<String, String> map = new HashMap<>();
        String keyword = request.getParameter("keyword");
        String status = request.getParameter("status");
        String current = request.getParameter("current");
        String size = request.getParameter("pageSize");
        String startDate = request.getParameter("startDate");
        String endDate = request.getParameter("endDate");
        map.put("keyword", keyword);
        map.put("current", current);
        map.put("pageSize", size);
        map.put("status", status);
        map.put("startDate", startDate);
        map.put("endDate", endDate);
        map.put("companyId", companyId+"");
        return service.getListPage(map);
    }



}

